﻿
@{
    ViewData["Title"] = "批量激活QuireEdit";
}

@section Scripts
    {
    <link href="~/css/page.css" rel="stylesheet" />
    <script type="text/javascript">
        var selfLayer = null, page = 1, active = null;
        layui.use(['layer', 'table', 'laydate','element'], function () {
            var layer = layui.layer //弹层
                ,table = layui.table, form = layui.form,element = layui.element; //表格

            //导航卡
            element.on('tab(table)', function (data) {
                if (data.index == 1) {
                    $('#qcode').removeAttr("lay-verify");
                    $('#qcodes').attr({ "lay-verify": "required" });
                } else if (data.index == 0)
                {
                     $('#qcodes').removeAttr("lay-verify");
                    $('#qcode').attr({ "lay-verify": "required" });
                }
                });
            //提交

            //单次提交
            form.on('submit(submit)', function () {
                var qrcode =  $('#qcode').val();
                axios({
                    method: 'post',
                    url: '/SignageApplication/UpdateSpecifyActivation',
                    //  contentType: 'application/x-www-form-urlencoded',
                    params: {
                        "qrCode":qrcode,
                       },
                    headers: { 'Authorization': 'Bearer ' + localStorage.getItem("X-TOKEN") }
                }) .then(function (response) {
                        console.log(response);
                        if (response.data.code == 200) {
                            javascript: history.go(-1);
                        } else {
                            alert(response.data.msg)
                        }

                    }).catch(function (error) {
                        console.log("添加失败!" + error);
                    });
                return false;
            });

            //批量提交
             form.on('submit(submits)', function () {
                var qrcode =  $('#qcodes').val();
                axios({
                    method: 'post',
                    url: '/SignageApplication/UpdateSpecifyActivationAll',
                    //  contentType: 'application/x-www-form-urlencoded',
                    params: {
                        "qrCodes":qrcode,
                       },
                    headers: { 'Authorization': 'Bearer ' + localStorage.getItem("X-TOKEN") }
                }) .then(function (response) {
                        console.log(response);
                        if (response.data.code == 200) {
                            javascript: history.go(-1);
                        } else {
                            alert(response.data.msg)
                        }

                    }).catch(function (error) {
                        console.log("添加失败!" + error);
                    });
                return false;
            });
        });

    </script>
}

<form class="layui-form layui-form-pane">
    <div class="layui-tab" lay-filter="table">
        <ul class="layui-tab-title">
            <li class="layui-this">二维码激活</li>
            <li>批量码激活</li>
        </ul>
        <div class="layui-tab-content">
            @*二维码配发*@
            <div class="layui-tab-item layui-show">
                <div class="layui-form-item">
                    <label class="layui-form-label">二维码</label>
                    <div class="layui-input-block">
                        <input type="text" class="layui-input w_545" style="height:38px;width:210px" lay-verify="required" autocomplete="off" id="qcode" />
                    </div>
                </div>
                <div class="layui-inline">
                    <div class="layui-form-block">
                        &nbsp; &nbsp; &nbsp;
                        <input class="layui-btn" type="button" style="width: 90px" lay-submit lay-filter="submit" value="立即提交" />
                        &nbsp; &nbsp; &nbsp;
                        <a asp-action="ActivationList" class="layui-btn layui-btn-primary backIframe" style="width: 90px; height: 28px; line-height: 28px;">返回</a>
                    </div>
                </div>

            </div>
            @*批量码配发*@
            <div class="layui-tab-item">
                <div class="layui-form-item">
                    <label class="layui-form-label">批量码</label>
                    <div class="layui-input-block">
                        <input type="text" class="layui-input w_545" style="height:38px;width:210px" autocomplete="off" id="qcodes" />
                    </div>
                </div>
                <div class="layui-inline">
                    <div class="layui-form-block">
                        &nbsp; &nbsp; &nbsp;
                        <input class="layui-btn" type="button" style="width: 90px" lay-submit lay-filter="submits" value="立即提交" />
                        &nbsp; &nbsp; &nbsp;
                        <a asp-action="ActivationList" class="layui-btn layui-btn-primary backIframe" style="width: 90px; height: 28px; line-height: 28px;">返回</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>

